package com.xiaobai.common.utils.result;

public class R {
    // 只返回状态
    public static Result success(ResultCode resultCode, String message) {
        return new Result().setCode(resultCode.getCode())
            .setMessage(message);
    }

    public static  Result success(Object data) {
        return new Result()
            .setCode(ResultCode.SUCCESS.getCode())
            .setData(data);
    }

    public static Result success(String message, Object data) {
        return new Result()
            .setCode(ResultCode.SUCCESS.getCode())
            .setMessage(message)
            .setData(data);
    }
    public static  Result success(ResultCode resultCode, String message, Object data) {
        return new Result()
            .setCode(resultCode.getCode())
            .setMessage(message)
            .setData(data);
    }

    // 只返回状态
    public static Result fail(ResultCode resultCode, String message) {
        return new Result().setCode(resultCode.getCode())
            .setMessage(message);
    }

    public static  Result fail(Object data) {
        return new Result()
            .setCode(ResultCode.SUCCESS.getCode())
            .setData(data);
    }

    public static  Result fail(ResultCode resultCode, String message, Object data) {
        return new Result()
            .setCode(resultCode.getCode())
            .setMessage(message)
            .setData(data);
    }


}
